package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000117656496";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDr0JiZ4375z0V2V7jcyN/YoGcFLwgr/7tGl26DDdrbRggV4ByPI9PFpv2Nludrvh3K596gCu4iOtuq+4uscbdNUvuVcwY/0XWo0fMcKVxoKBrgON/Pm5U4rw3no3U7MDL3HLdyFHLMqO4a2f5MagdpiGS7TZXRrigNln0UMI7F1SfNu4K4FOrR18JOJK2IJk89Iin0vnMPclo4CBRGVqwO5Ib6WKBFeN9sRUg/vQoZP08xvoLPnUnh7O9C1rkHBqetUYC+uW+aQZELGC3pVvisnLdu0wLMe8hiISSgvKKL5JWdXj2O8g+/N2OvG9rGK50tgZVnw7DMdCQZ+NL4nF7/AgMBAAECggEAJDvbFtpD6nKUw8ha2WHsM0cCTWOap9gVmJUwH+cDF+o818+l08C3i4lLMHRdfsqpnUHfjUvgp1XP5wfbwFWAytrTWXVhInE22QfZiRw53K884fMbQLUxSpJrWopdOwj+68V30omd0iCq5WlVj7xDA0433Cfhu2Q9N0lGUtHbPj5k6UjXgD74k2rNMjIc2be+w6NA6CAdPNACpcEy899QNVVjpLd51WmXDci54voFqKP1L6CgaPj0Uou4tVnqBJ7VFHl6QJPd7b7T6B5ryvPdQ62TQFtfm23wjka66/dQiR82bzy84VnUmd9sC3j8lyMX7uhReQl2WWjp1iNam/lSsQKBgQD5jTrijxgyA+1qEILhkSIwvMXsVZQB/4aQi4s9JDOXIxBN8aZCLGgegPmvdwCfWvA2H1T3foNMc43gR5WQr3tpMTLH+XEsOLDMbKw8QlehAwh6hX+CskxeifRqb78SfSIrKXFGmydWTOD2qOJF7o/LtfPGnSMCjgwvaqF9sJx65QKBgQDx6H9iqXVNnXoQuoXOTtwKsBo7Mm9nBbhy8JJhWef/s+klTcPyFR0/14XFVMNQy8rbW5Tpy5nhesaynw7wjWrDJ5pbKk50DHvuSXPtwNW/F0d9ljsloVcfgT/ddZ++HH5l0Iilcm0sKI/uwXUeRUmTfO/gWV/EsddFzixZ0s5AEwKBgQDw0v8plmgGFE4wFiEIJ3Q0Tmg+q1N7HimxIklLxrzWtKrOXU5R++K61UKftxrtree0g0YO1ZNF2xnmf45xozdYi3bzDuDNiSPtE06flHJWWsP64Qvth701WrJ5aL+eyw2HU6YSOjabDPPodZBvZkp0j3HikNAxbf2KYL/ZuO85lQKBgFUVzLBcICkziXqW0Hd3H0gXFrLZk3tt9Klg2mupXsN+eTOovZHJQWdyG9gDb0tc0rYC6UauWSqIr5il/3A2nWWU6WLFZ6DDv1dZuI/YcpXqzzdp/tXGgMlRAbCYLZ6FkSOojFd8/s84WR/GJbaG8lEQ8aI8bUXWs3wW/1x8nBTHAoGACHHIAPur3P+rki2f482t4QGQ/yg94mWuIctLQ7RujYtEOj+DzT8EdKqhWp154DEuk1L2O9TXwIF1j2r7rXpx5d14SIEID9DXbsZv/8Cv1C3lYi8RypLp7s8yGk7cvmVT3rEiKEKEH6eSi3xQDEvrTa2hLcZ+xS3iwXyEliCxtJQ=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm5igvNT+u0M8K5eAtUaMSYukwsWjJ3O03zR5nucwbd32ZZJTQeOPdVfegab5cyfiaUcwOkLKI7Iz7WHRh3GO8U6vgiSOtqh77hIOmSCbYy5AaF0bflgmEiJWGO7591rKJ/4ph+m6W4GT65VDw+7Ci/OqJiXsPK7Bswjj1ULCWJJaxdAw0o3vUQ0T4D9MXO9ir6tHtIm0ZiuGMFS3mALKSWCaFklhR2sFPa8e9s5AdKwqSLXzN/99uWBYTrOnMEZQSF+/mo9Z+T6piGabxRenp2bMyIqU68AHt8dVCSRimlgHYaUsjDuVh5+Y3RDq+OLr9x4LFVMGNnyl4wN1Zx0UxQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
//	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
    //支付宝沙箱支付网关
    public static String gatewayUrl ="https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "D:\\alipaylog";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

